<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><{:C('site_name')}></title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">

<script type="text/javascript" src="<{:STATICS}>/js/jquery.min.js"></script>
<script type="text/javascript" src="<{:STATICS}>/js/jquery.form.min.js"></script>
<script type="text/javascript" src="<{:STATICS}>/layui/lay/dest/layui.all.js"></script>
<script type="text/javascript" src="<{:STATICS}>/js/regExp.js"></script>
<script type="text/javascript" src="<{:RES}>/js/common.js"></script>

<link rel="stylesheet" href="<{:STATICS}>/layui/css/layui.css" media="all" />
<link rel="stylesheet" href="<{:STATICS}>/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="<{:RES}>/css/global.css" media="all">
<script>
$(function(){
	//ajaxform
	var options = { 
		dataType:'json',
		beforeSubmit:showRequest,//表单验证方式
        success:showResponse  // post-submit callback 
    }; 

    $('#iframForm').ajaxForm(options); 

    function showResponse(responseText, statusText)  {
		if (statusText == 'success') {
			parent.layer.close(load);
			if (responseText.status==1) {
				parent.layer.open({
					type:0, 
					icon:1,
					content:responseText.info,
					time:3000,
					end: function(){ 
						var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
						parent.layer.close(index);
						parent.location.reload();
					} 
				});
			}else{
				parent.layer.open({
					type:0, 
					icon:2,
					content:responseText.info
				});
			}
		}else{
			parent.layer.msg('服务器错误');
		}
	} 

	function showRequest(){
		load = parent.layer.load(0,{shade: [0.7, '#000000']});
	}
})
</script>

</head>
<body>
<div class="iframeBox">
	<form id="iframForm" class="layui-form" method="post" action="<{:U('Category/edit')}>">		
		<div class="layui-form-item">
			<label class="layui-form-label">父栏目</label>
			<div class="layui-input-block">
				<select name="fid" id="fid" lay-filter="fid" lay-verify="required">
				<option value="0">根栏目</option>
		        <volist name="cate" id="vo">
		        <option value="<{$vo['id']}>"><php>
		            for($i=0; $i<$vo['count']*2; $i++){
		               echo '&nbsp;&nbsp;';            
		            }
		        </php><{$vo['name']}></option>
		        </volist>
		        </select>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">名称</label>
			<div class="layui-input-block">
				<input type="text" name="name" lay-verify="required" class="layui-input" value="<{$list['name']}>" placeholder="必填">
			</div>
		</div>	

		<div class="layui-form-item layui-form-text">
			<label class="layui-form-label">描述</label>
			<div class="layui-input-block">
				<input type="text" name="intr" value="<{$list.intr}>" class="layui-input" />
			</div>
		</div>

		<div class="layui-form-item layui-form-text">
			<label class="layui-form-label">管理员</label>
			<div class="layui-input-block">
				<input type="text" name="user" value="<{$list['user']}>" class="layui-input">
				<p>多个用户使用"|"进行分割，如：aaa|bbb|ccc...，不填则只有系统管理员维护</p>
			</div>
		</div>

		<div class="layui-form-item layui-form-text">
			<label class="layui-form-label">外链</label>
			<div class="layui-input-block">
				<input type="text" name="url" value="<{$list['url']}>" class="layui-input" lay-verify="_url">
			</div>
		</div>

		<div class="layui-form-item layui-form-text">
			<label class="layui-form-label">图片地址</label>
			<div class="layui-input-inline" style="width:400px">
				<input type="text" id="picname_url" name="picname" value="<{$list.picname}>" class="layui-input">
			</div>
			<div class="layui-inline">
				<input type="button" value="上传" class="layui-btn" onclick="uploadfile('<{:U('Upload/image')}>','picname');" />
			</div>
		</div>

		<div class="layui-form-item layui-form-text">
			<label class="layui-form-label">排序</label>
			<div class="layui-input-block">
				<input type="text" name="sort" class="layui-input" value="<{$list['sort']}>" placeholder="必填" lay-verify="number">
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit="">立即提交</button>
			</div>
		</div>
		<input type="hidden" name="id" value="<{$list['id']}>" />
		<input type="hidden" name="thisFID" value="<{$list['fid']}>" />
		<input type="hidden" name="path" value="<{$list['path']}>" />
		<input type="hidden" name="model" value="<{$list['model']}>">
	</form>
</div>
<!--上传文件-->
<form style="display:none;" id='myupload' action="" method='post' enctype='multipart/form-data'>
<input id="fileupload" type="file" name="file">
</form>
<div id="uploading" style="display:none;">
	<div class="wrapper">
		<div class="load-bar">   
			<div class="load-bar-inner" data-loading="0"> <span id="counter">0%</span> </div> 
		</div>  
		<p>请等待... </p>
	</div>
</div>
<script type="text/javascript">
$("#fid").val("<{$list['fid']}>");
</script>
</body>
</html>